<%--
    Document   : gameBoard
    Created on : Oct 20, 2010, 10:29:32 AM
    Author     : beomjoongkwon
--%>

<%@page import="Hangman.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="Hangman.Player" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

            <jsp:useBean id="play" scope="session" class="Hangman.Player" />
            <jsp:setProperty name="play" property="*" />

<%
    Word word = new Word((String) request.getParameter("word"));
    //out.println(request.getParameter("word"));
    out.println(word.toString());
    out.println(word.initializeWord());
    out.println(play.getUserID());
    int wordLength = word.getMaxLength();
    final int playerNumber = 4;
    String player = "";
    String letterPosition = "";
    String lbl="_";
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="refresh" content="3">
        <title>Game Board</title>

    <style type="text/css">
        body {
        margin:0;
        }
        #wrap {
        width:600px;
        height:370px;
        background-color:#7BECCA;
        position:absolute;
        top:20%;
        left:50%;
        margin-top:-50px;
        margin-left:-250px;
        }
    </style>

    </head>
    <body>
        <div id="wrap" align="center"><br>
            <form  method="post">
            <table border="1" >
            <%
            for (int i = 0; i < playerNumber; i++) {
                player = "Player" + i + " ";
            %>
            <tr>
            <td>
                <% out.print(player);%></td>

                <%

                for (int j = 0; j < wordLength; j++) {

                    letterPosition = player + i + "_" + j;
            %>
            <%--
                LetterPosition Format : Player[Num1]_[Num2], Num1 : player number, Num2 : letter position
                Example : "Player1_1", first letter of player1's word
                          "Player3_2", second letter of player3's word
            --%>
            <td><label name=letterPosition><% out.print(lbl); %></label></td>

            <%
                }
            %>
            </tr>
            <%

            out.println("<BR>");
            }
            %>
             </table>
             <br><br>
            <input type="text" name=guessLetter value="" size="1" />
            <input type="submit" value="Guess Letter" name="guessLetter" />
            <br><br>
            </form>
            <form action="welcome.jsp" method="post">
                <input type="submit" value="Quit Game" name="quitGame" />
            </form>
        </div>

    </body>
</html>